"""
可滚动的K线图
"""
import candlestick as cd
import matplotlib.pyplot as plt
from matplotlib import dates, ticker
import matplotlib as mpl
from mpl_finance import candlestick2_ohlc
import matplotlib.dates as mdates

import datetime
import time
import sqlite3
import matplotlib.patches as patches
import datetime
from  iplot.bar import IndexTracker

plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号


if __name__ == '__main__':
    
    
    
    fig, ax = plt.subplots(figsize=(15, 9))

    start_date = '2016-01-12'
    space = 86400
    tracker = IndexTracker(ax, fig,start_date,space)
    # 先不用滚轮，用左右方向键
    # fig.canvas.mpl_connect('scroll_event', tracker.onscroll)
    fig.canvas.mpl_connect('key_press_event', tracker.press)
    plt.show()
